<template>
  <div id="box">
    <div class="flex title">
      <img src="/public/img/dangerous.svg" alt="" />
      <p>监测报警</p>
      <img src="/public/img/close.svg" class="close pointer" alt="" @click="close" />
    </div>

    <div class="flex m-t-12">
      <div>
        <p class="name">报警设备</p>
        <p class="value">无人值守飞行器</p>
      </div>
      <div>
        <p class="name">呼叫时间</p>
        <p class="value">{{ day }}</p>
      </div>
    </div>

    <div class="m-t-20">
      <p class="name">关联网格</p>
      <p class="value">外勤作业</p>
    </div>

    <div class="m-t-20">
      <p class="name">呼叫事件</p>
      <p class="value">识别到场内危险作业行为</p>
    </div>

    <audio
      autoplay="autoplay"
      id="auto"
      src="https://pandiaochang.oss-cn-chengdu.aliyuncs.com/uploadfile/20220825/%E8%AD%A6%E6%8A%A5%E5%A3%B0-%E6%B8%B8%E6%88%8F%E6%8F%90%E7%A4%BA%E9%9F%B3_%E7%88%B1%E7%BB%99%E7%BD%91_aigei_com.mp3"
    ></audio>
  </div>
</template>

<script setup>
import { useWidgetStore } from "@mars/common/store/widget"
import axios from "axios"
import { onMounted } from "vue"
import { map } from "@mars/index"
import dayjs from "dayjs"
const widgetStore = useWidgetStore()
const props = defineProps(["data"])

const day = dayjs(new Date()).format("YYYY-MM-DD hh:mm")

const close = () => {
  widgetStore.dispatch("disable", "dangerous")
}

onMounted(() => {
  // setTimeout(() => {
  //   map.setCameraView({
  //     lat: 30.381702,
  //     lng: 103.919271,
  //     alt: 50,
  //     pitch: -18,
  //     heading: 258
  //   })
  // }, 400)
  console.log(props.data)
  axios
    .get("http://ydsq.chuangxing.ren/api/index/set_hujiao_read", {
      params: {
        id: props?.data?.id
      }
    })
    .then((res) => {
      console.log(map)
    })
})
</script>

<style lang="less" scoped>
#box {
  position: fixed;
  z-index: 9999;
  width: 599px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #f34336;
  background: #2b05056e;
  backdrop-filter: blur(20px);
  padding: 20px;

  animation: animated-border 1s infinite;

  div {
    width: 100%;
  }

  .title {
    padding-bottom: 13px;
    position: relative;

    &::after {
      content: "";
      width: 100%;
      height: 2px;
      background: linear-gradient(90deg, rgba(243, 67, 54, 0) 0%, #f34336 91.76%);
      position: absolute;
      bottom: 0;
      left: 0;
    }

    img {
      width: 48px;
      height: 48px;
    }

    p {
      margin-left: 28px;
      font-size: 42px;
      font-weight: bold;
      color: #f34336;
    }

    .close {
      margin-left: auto;
      margin-right: 0;
      width: 28px;
      height: 28px;
    }
  }

  .name {
    color: #f34336;
    font-size: 20px;
    line-height: 1.7;
  }

  .value {
    font-size: 28px;
    color: #fff;
    font-weight: bold;
    margin-top: 4px;
    line-height: 1.7;
  }

  #auto {
    height: 0;
    width: 0;
  }
}

.m-t-12 {
  margin-top: 12px;
}

.m-t-20 {
  margin-top: 20px;
}

@keyframes animated-border {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 67, 54, 0.8);
  }

  100% {
    box-shadow: 0 0 100px 100px rgba(243, 67, 54, 0);
  }
}
</style>
